/**
 * @(#)MonitorFlagServiceImpl.java 2017年5月5日
 * Copyright(C) 2017年5月5日 ZHEXIN IT CO.,LTD. All rights reserved.
 */
package org.jsbd.boss.service.impl;


import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.jsbd.boss.dao.IMonitorFlagDao;
import org.jsbd.boss.domian.monitor.MonitorFlagBean;
import org.jsbd.boss.domian.monitor.MonitorFlagLogBean;
import org.jsbd.boss.service.IMonitorFlagService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * TODO 请加入本类的说明
 * @author <a href="mailto:zhouchao@zhexinit.com" >周超</a>
 * @version 1.0.0
 */
@Service("monitorFlagService")
public class MonitorFlagServiceImpl implements IMonitorFlagService {
	public static final Logger LOGGER = LoggerFactory.getLogger(MonitorFlagServiceImpl.class);

	@Autowired
	private IMonitorFlagDao monitorFlagDao;
	
	@Override
	public Map<String, MonitorFlagBean> getMonitorFlagMap(int type) {
		List<MonitorFlagBean> monitorFlagList=monitorFlagDao.getMonitorFlagBeanByType(type);
		if(monitorFlagList==null||monitorFlagList.isEmpty()){
			return null;
		}
		
		Map<String,MonitorFlagBean> resultMap=new HashMap<String,MonitorFlagBean>();
		for(MonitorFlagBean monitorFlag:monitorFlagList){
			resultMap.put(monitorFlag.getMonitorName(), monitorFlag);
		}
		
		return resultMap;
	}

	
	@Override
	public void updateMonitorFlag(List<MonitorFlagBean> mointorFlagList) {
		monitorFlagDao.updateMonitorFlagBeanFlag(mointorFlagList);
	}

	
	@Override
	public void saveMonitorFlagLog(List<MonitorFlagBean> mointorFlagList) {
		monitorFlagDao.saveMonitorFlagLog(mointorFlagList);
	}
}
